<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>下拉菜单</title>
        <style>
              *{
                    margin:0;
                    padding:0;
               }
                select{
                     width: 100px;
               }
        </style>
</head>
<body>
      <select></select>
      <button onclick="showMenu()">生成</button>

      <script>
      var arr = ['北京','上海','天津','杭州','深圳','兰州','太原','济南'];
      var MenuWp = document.getElementsByTagName('select')[0];
      var menu = '';
      function showMenu() {
                 if(MenuWp.childNodes.length == 0) {
                    for(var i in arr) {
                        menu+='<option value="">'+arr[i]+'</option>';
                    }
                    MenuWp.innerHTML = menu;
                 }
      }
      </script>
</body>
</html>